<?
	extract($_POST);
	ob_start();
	$sansserif 	=	'"Frutiger","Univers","Helvetica Neue",arial,helvetica,sans-serif';
	$serif		=	'"Constantia",Georgia,"Times New Roman",serif';
	if(!function_exists('color_hex2dec')) {
		function color_hex2dec ($color) { // From http://us3.php.net/manual/en/function.imagecreatetruecolor.php
			return array (hexdec (substr ($color, 0, 2)), hexdec (substr ($color, 2, 2)), hexdec (substr ($color, 4, 2)));
		}
	}
	list($visted_r, $visted_g, $visted_b) = color_hex2dec($dryan_rounded_content_links);
	list($bg_r, $bg_g, $bg_b) = color_hex2dec($dryan_rounded_bg);
	$dryan_rounded_content_links_visted = substr(dechex((round(($bg_r - $visited_r) / 2) + $visted_r) . (round(($bg_g - $visited_g) / 2) + $visted_g) . (round(($bg_b - $visited_b) / 2) + $visted_b)),0,6);
	list($visted_r, $visted_g, $visted_b) = color_hex2dec($dryan_rounded_content_links);
	list($bg_r, $bg_g, $bg_b) = color_hex2dec($dryan_rounded_sidebar_bg);
	$dryan_rounded_sidebar_links_visted = substr(dechex((round(($bg_r - $visited_r) / 2) + $visted_r) . (round(($bg_g - $visited_g) / 2) + $visted_g) . (round(($bg_b - $visited_b) / 2) + $visted_b)),0,6);
?>
<!--
body		{
	background-color: #<? echo $dryan_rounded_bg; ?>;
}

#wrapper {
	<? if($dryan_rounded_width == 'fixed') { echo "width: 720px;\n"; } ?>
}

#header		{
	background-color: #<? echo $dryan_rounded_header_bg; ?>; 
	color: #<? echo $dryan_rounded_header_color; ?>;
	font-family: <? if($dryan_rounded_header_font == 'serif') { echo $serif; } else { echo $sansserif; }?>;
	<? if($dryan_rounded_style == 'square') { echo "background-image: none !important;\n"; } ?>
}

#header h1, #header h1 a	{
	<? if($dryan_rounded_style == 'square') { echo "background-image: none !important;\n"; } ?>
	color: inherit;
}

#header .pages_list {
	<? if($dryan_rounded_style == 'square') { echo "background-image: none !important;\n"; } ?>
}

#header .pages_list li {
	<? if($dryan_rounded_style == 'square') { echo "background-image: none !important;\n"; } ?>
	background-color: #<? echo $dryan_rounded_header_color; ?>;
}

#header .pages_list li a {
	<? if($dryan_rounded_style == 'square') { echo "background-image: none !important;\n"; } ?>
	color: #<? echo $dryan_rounded_header_bg; ?>;
}

#header .pages_list li.current a {
	color: #<? echo $dryan_rounded_content_links; ?>;
}

#content	{
	color: #<? echo $dryan_rounded_content_color; ?>;
	font-family: <? if($dryan_rounded_content_font == 'serif') { echo $serif; } else { echo $sansserif; }?>
}

#content a	{
	color: #<? echo $dryan_rounded_content_links; ?>;
}

#content a:visted	{
	color: #<? echo $dryan_rounded_content_links_visted; ?>;
}

#content h2, #content h2 a, #content h3, #content h3 a	{
	font-family: <? if($dryan_rounded_content_headline_font == 'serif') { echo $serif; } else { echo $sansserif; }?>
	color: #<? echo $dryan_rounded_content_headlines; ?>;
}

#content .post_meta, #content .post_meta a {
	color: #<? echo $dryan_rounded_content_meta; ?>;
}

.image_thumb	{
	border-color: #<? echo $dryan_rounded_content_links; ?>;
}

#event_month_detailed tr, #event_month_simple tr {
	border-color: #<? echo $dryan_rounded_content_meta; ?>;
}

#event_month_detailed td {
	border-color: #<? echo $dryan_rounded_content_meta; ?>;
}

#event_month_simple td {
	border-color: #<? echo $dryan_rounded_content_meta; ?>;
}

#event_month_detailed th, #event_month_simple th {
	background: #<? echo $dryan_rounded_content_meta; ?>;
	color: #<? echo $dryan_rounded_sidebar_bg; ?>;
	border-color: #<? echo $dryan_rounded_content_meta; ?>;
}

#event_month_detailed .event_month_date {
	background-color: #<? echo $dryan_rounded_content_meta; ?>;
	color: #<? echo $dryan_rounded_content_color; ?>;
	border-left-color: #<? echo $dryan_rounded_content_meta; ?>;
	border-bottom-color: #<? echo $dryan_rounded_content_meta; ?>;
}

#sidebar	{
	background-color: #<? echo $dryan_rounded_sidebar_bg; ?>;
	<? if($dryan_rounded_style == 'square') { echo "background-image: none !important;\n"; } ?>
	color: #<? echo $dryan_rounded_sidebar_color; ?>;
	font-family: <? if($dryan_rounded_sidebar_font == 'serif') { echo $serif; } else { echo $sansserif; }?>
}

#sidebar_top {
	<? if($dryan_rounded_style == 'square') { echo "background-image: none !important;\n"; } ?>
}

#sidebar h2, #sidebar h3 {
	color: #<? echo $dryan_rounded_sidebar_headlines; ?>;
	font-family: <? if($dryan_rounded_sidebar_headline_font == 'serif') { echo $serif; } else { echo $sansserif; }?>
}

#sidebar a {
	color: #<? echo $dryan_rounded_sidebar_links; ?>;
}

#sidebar a:visted {
	color: #<? echo $dryan_rounded_sidebar_links_visted; ?>;
}

#sidebar_btm_left, #sidebar_btm_right {
	<? if($dryan_rounded_style == 'square') { echo "background-image: none !important;\n"; } ?>
}

#footer		{
	background-color: #<? echo $dryan_rounded_footer_bg; ?>;
	<? if($dryan_rounded_style == 'square') { echo "background-image: none !important;\n"; } ?>
	color: #<? echo $dryan_rounded_footer_color; ?>;
	font-family: <? if($dryan_rounded_footer_font == 'serif') { echo $serif; } else { echo $sansserif; }?>
}

#footer p	{
	<? if($dryan_rounded_style == 'square') { echo "background-image: none !important;\n"; } ?>
}
-->
<?	
	$css = str_replace(array('<!--','-->'),'',ob_get_contents());
	if($file = fopen(dirname(__FILE__) . "/custom.css","w")) {
		fwrite($file,$css);
		fclose($file);
	}
	ob_flush();
?>
